package com.basksoft.server.demo.config;

import org.springframework.boot.web.servlet.FilterRegistrationBean;
import org.springframework.context.EnvironmentAware;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.env.Environment;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

import com.basksoft.core.BaskFilter;
import com.basksoft.server.demo.ToolSpring;

@Configuration
public class BaskServerConfig implements WebMvcConfigurer,EnvironmentAware {
	
	@Bean
    public FilterRegistrationBean<BaskFilter> registerReportFilter() {
        FilterRegistrationBean<BaskFilter> registration = new FilterRegistrationBean<BaskFilter>(new BaskFilter());
        registration.addUrlPatterns("/baskserver/*");
        registration.setName("bask");
        registration.setOrder(1);  
        return registration;
    }

	@Override
	public void setEnvironment(Environment environment) {
		ToolSpring.setEnvironment(environment);
	}
}
